home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MYMUD21.ZIP / MMUD21.ZIP / SOURCE / SOURCE.ZIP / DEBUG_DO.PAS < prev    next >
Pascal/Delphi Source File  |  1995-01-21  |  2KB  |  81 lines

  1. {$I COPYRGHT.INC}
  2.  
  3. (*---------------------------------------------------------------------------*
  4.   Routines which are used during debugging.
  5.  *---------------------------------------------------------------------------*)
  6.  
  7. Unit Debug_do;
  8. Interface
  9. Uses BIN_DB,
  10.      MyIO,
  11.      Misc,
  12.      Multi,
  13.      LowLevel,
  14.      Header,
  15.      Norm_do;
  16.  
  17. (*---------------------------------------------------------------------------*
  18.   Show the contents of a record. Can search on name or n #<number>
  19.  *---------------------------------------------------------------------------*)
  20. Procedure DEBUG_ShowRecord(Current : ContextType; InpStr : String);
  21.  
  22. (*---------------------------------------------------------------------------*
  23.   Fix a record which is messed up for whatever reason.
  24.  *---------------------------------------------------------------------------*)
  25. Procedure DEBUG_Fix(Current : ContextType; InpStr : String);
  26.  
  27. Implementation
  28.  
  29. Procedure DEBUG_Fix(Current : ContextType; InpStr : String);
  30. Var ObjNr : Integer;
  31. Begin
  32. ObjNr:=Str2ObjNr(Current,InpStr);
  33. If ObjNr=NOTHING
  34.    Then Begin
  35.         My_WriteLn('Sorry, item is not here.');
  36.         Exit;
  37.         End;
  38. Current.DB.ReadObj(ObjNr);
  39. My_WriteLn('Name: '+Current.DB.ObjRec.Name);
  40. If My_YesNo('Sure? ','N')='N'
  41.    Then Exit;
  42.  
  43. Lock('Fixing Object');
  44. Current.DB.ReadObj(ObjNr);
  45. With Current.DB.ObjRec Do
  46.  Begin
  47.  Next:=Nothing;
  48.  ObjType  :=Thing_Type;;
  49.  Owner    :=Current.Player;
  50.  Location :=Current.Player;
  51.  Exits    :=Current.Player;
  52.  Attr_Flags:=0;
  53.  Room_Flags:=0;
  54.  GenFlags :=0;
  55.  End;
  56. Current.DB.UpdateObj(ObjNr);
  57. MoveTo(ObjNr,Current.Player);
  58. UnLock;
  59. End;
  60.  
  61. Procedure DEBUG_ShowRecord(Current : ContextType; InpStr : String);
  62. Var ObjNr : Integer;
  63.     Err   : Integer;
  64. Begin
  65. If InpStr=''
  66.    Then Exit;
  67.  
  68. ObjNr:=Str2ObjNr(Current,InpStr);
  69. If (ObjNr>=FileSize(Current.DB.ObjFile)) Or
  70.    (ObjNr=NOTHING)
  71.    Then begin
  72.         My_WriteLn('Sorry, record doesn''t exist');
  73.         Exit;
  74.         End;
  75.  
  76. Current.DB.ReadObj(ObjNr);
  77. Current.DB.WriteRecord;
  78. End;
  79.  
  80. End.
  81.